﻿using System;
using System.Collections.Generic;
using System.Text;

namespace UtilZ.Dotnet.Ex.Communication.Net.Telnet.KeyCommands
{
    internal class EndCommand : TelnetKeyCommandAbs
    {
        /**********************************************
        *          windows          linux        mac
        * code     27-91-52-126     27-91-70     27-91-70
        **********************************************/

        public EndCommand()
              : base()
        {

        }

        protected override bool PrimitveProcess(ListenTelnetClient telnetClient, byte[] data, int revicedDataLength)
        {
            if (revicedDataLength == 4 && data[0] == 27 && data[1] == 91 && data[2] == 52 && data[3] == 126 ||//windows
                revicedDataLength == 3 && data[0] == 27 && data[1] == 91 && data[2] == 70)//linux-mac
            {                
                telnetClient.CurrsorMoveToEnd();
                return true;
            }

            return false;
        }
    }
}
